package com.study.dao.impl;
import com.study.bean.User;
import com.study.util.JdbcUtil;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;
import java.sql.SQLException;
public class UserDaoImpl {
    public static User getUserByLogin(String name,String password) throws SQLException {
        String sql = "select * from user  where name = ? and password = ?";
        QueryRunner queryRunner = new QueryRunner();
        Object[] objects = {name,password};
        User query = queryRunner.query(JdbcUtil.getConnection(), sql, new BeanHandler<>(User.class), objects);
        return query;

    }
}
